﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using DTO;
using BUS;

namespace WebSieuThi.QuanLi
{
    public partial class WebForm3 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //loadquidinhkh()
            RegisterStartupScript("loadqd", "<script language=JavaScript>loadquidinhkh();</script>");

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime d1 = Calendar1.SelectedDate;
            DateTime d2 = Calendar2.SelectedDate;
            double giatri = double.Parse(TextBox1.Text.ToString());

            KhuyenMai km = new KhuyenMai();
            km.NgayApDung = d1;
            km.NgayKetThuc = d2;
            km.PhanTramGiam = giatri;

            bool b = KhuyenMaiBUS.Them(km);
            if(b)
                kqkhuyenmai.InnerHtml = "Thêm thành công!";
            else
                kqkhuyenmai.InnerHtml = "Thêm thất bại!";


        }

        
    }
}
